package com.all.widget.fragment;

import com.all.ui.R;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class HomeFragmentLeft extends ListFragment {

	 @Override
	    public View onCreateView(LayoutInflater inflater, ViewGroup container,
	            Bundle savedInstanceState) {
	        return inflater.inflate(R.layout.fragment_sliding_layout_left, container, false);
	    }

	    @Override
	    public void onViewCreated(View view, Bundle savedInstanceState) {
	        super.onViewCreated(view, savedInstanceState);
	        setListAdapter(new MyListAdapter());
	    }

	    private class MyListAdapter extends BaseAdapter {

	        @Override
	        public int getCount() {
	            return 30;
	        }

	        @Override
	        public Object getItem(int position) {
	            return null;
	        }

	        @Override
	        public long getItemId(int position) {
	            return 0;
	        }

	        @Override
	        public View getView(int position, View convertView, ViewGroup parent) {
	        	RelativeLayout result = (RelativeLayout) convertView;
	            if (result == null) {
	                result = (RelativeLayout) LayoutInflater.from(parent.getContext())
	                        .inflate(R.layout.list_item, parent, false);
	            }
	            ((TextView)result.findViewById(R.id.id_treenode_label)).setText("My custom element #" + position);

	            return result;
	        }
	    }
}
